//
//  UIButton+CYButton.m
//  cyjf
//
//  Created by tauCross on 2017/5/3.
//  Copyright © 2017年 Auto Financing. All rights reserved.
//

#import "UIButton+CYButton.h"



@implementation UIButton (CYButton)

+ (instancetype)cy_mainButtonWithTitle:(NSString *)title
{
    UIButton *button = [[UIButton alloc] init];
    [button setBackgroundImage:[UIImage imageWithColor:APP_DEFAULT_COLOR_RED size:CGSizeMake(1, 1)] forState:UIControlStateNormal];
    [button setTitle:title forState:UIControlStateNormal];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    button.titleLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium];
    button.layer.masksToBounds = YES;
    button.layer.cornerRadius = 3;
    return button;
}

+ (instancetype)cy_hintButtonWithDesc:(NSString *)desc content:(NSString *)content fontSize:(CGFloat)fontSize
{
    UIButton *button = [[UIButton alloc] init];
    NSMutableAttributedString *string = [[NSMutableAttributedString alloc] init];
    UIFont *font = [UIFont systemFontOfSize:fontSize weight:UIFontWeightRegular];
    UIColor *descColor = HEXCOLOR(@"666666");
    UIColor *contentColor = APP_DEFAULT_COLOR_BLUE;
    [string appendAttributedString:[[NSAttributedString alloc] initWithString:desc ? desc : @"" attributes:@{NSFontAttributeName : font, NSForegroundColorAttributeName : descColor}]];
    [string appendAttributedString:[[NSAttributedString alloc] initWithString:content ? content : @"" attributes:@{NSFontAttributeName : font, NSForegroundColorAttributeName : contentColor}]];
    [button setAttributedTitle:string forState:UIControlStateNormal];
    return button;
}

@end
